package com.lex.newbasketball.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ListView;

import com.lex.newbasketball.R;
import com.lex.newbasketball.adapter.DiscoveryAdapter;
import com.lex.newbasketball.adapter.WonderAdapter;
import com.lex.newbasketball.base.BaseFragment;
import com.lex.newbasketball.entity.DiscoveryEntity;
import com.lex.newbasketball.entity.WonderEntity;

import java.util.ArrayList;
import java.util.List;

public class DiscoveryFragment extends BaseFragment {
    private ListView discovery_list;
    private static DiscoveryFragment self;

    public synchronized static DiscoveryFragment getInstance(){
        if (self == null) self = new DiscoveryFragment();
        return self;
    };

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.header_discovery_list);
    }

    @Override
    protected void findView() {
        discovery_list = (ListView) findViewById(R.id.discovery_list);

    }

    @Override
    protected void initView() {
        DiscoveryAdapter discoveryAdapter = new DiscoveryAdapter(getActivity(),getRecordData());
        discovery_list.setAdapter(discoveryAdapter);
        discovery_list.addHeaderView(View.inflate(getActivity(),R.layout.fragment_discovery,null));
    }

    private List<DiscoveryEntity> getRecordData(){
        List<DiscoveryEntity>discoveryEntityList = new ArrayList<>();
        discoveryEntityList.add(new DiscoveryEntity("附近球员",R.mipmap.discovery_people_bg,R.mipmap.discovery_people_icon));
        discoveryEntityList.add(new DiscoveryEntity("附近场馆",R.mipmap.discovery_basketball_bar_bg,R.mipmap.discovery_basketball_bar_icon));
        discoveryEntityList.add(new DiscoveryEntity("训练场",R.mipmap.discovery_camp_bg,R.mipmap.discovery_camp_icon));
        discoveryEntityList.add(new DiscoveryEntity("23篮球吧",R.mipmap.discovery_venue_bg,R.mipmap.discovery_venue_icon));
        return discoveryEntityList;
    }
}
